<template>
  <div class="owner-card">
    <div class="card-content" @click="handleBecomeOwner">
      <div class="avatar-section">
        <img src="@/assets/imgs/avatar_unlogin.png" alt="头像" class="avatar" />
      </div>
      <div class="text-section">
        <h4 class="title">我要成为业主</h4>
        <p class="subtitle">一键发布房源信息</p>
      </div>
      <div class="action-section">
        <span class="action-text">立即委托</span>
        <img src="@/assets/imgs/arrow_right.svg" alt="箭头" class="arrow-icon" />
      </div>
    </div>
  </div>
</template>

<script setup>
import { ElMessage } from 'element-plus'
import { useRouter } from 'vue-router'

const router = useRouter()

const handleBecomeOwner = () => {
  ElMessage.info('跳转到业主委托页面')
  router.push({ name: 'RoomAdd'})
  console.log('成为业主点击')
}
</script>

<style scoped>
.owner-card {
  margin: 0 16px 20px;
}

.card-content {
  background-color: #fff;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #f0f0f0;
}

.card-content:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: #409eff;
}

.avatar-section {
  margin-right: 12px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #f0f0f0;
}

.text-section {
  flex: 1;
}

.title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin: 0 0 4px 0;
}

.subtitle {
  font-size: 12px;
  color: #666;
  margin: 0;
}

.action-section {
  display: flex;
  align-items: center;
}

.action-text {
  font-size: 14px;
  color: #409eff;
  font-weight: 500;
  margin-right: 4px;
}

.arrow-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.card-content:hover .arrow-icon {
  transform: translateX(4px);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .owner-card {
    margin: 0 12px 16px;
  }
  
  .card-content {
    padding: 12px;
  }
  
  .avatar {
    width: 40px;
    height: 40px;
  }
  
  .title {
    font-size: 14px;
  }
  
  .subtitle {
    font-size: 11px;
  }
  
  .action-text {
    font-size: 12px;
  }
}
</style>
